<html>
<head><meta charset="utf-8"><title>async aware version of OnceCell · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/async.20aware.20version.20of.20OnceCell.html">async aware version of OnceCell</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="230335432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/async%20aware%20version%20of%20OnceCell/near/230335432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Snoyman <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/async.20aware.20version.20of.20OnceCell.html#230335432">(Mar 15 2021 at 12:24)</a>:</h4>
<p>Is there some crate that provides a variant of <code>once_cell::sync::OnceCell</code>, but async/Future aware?  Essentially I'm looking for a <code>get_or_init</code> which is an <code>async fn</code>. I thought I saw it somewhere once, but I'm having trouble finding it now</p>



<a name="230337435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/async%20aware%20version%20of%20OnceCell/near/230337435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/async.20aware.20version.20of.20OnceCell.html#230337435">(Mar 15 2021 at 12:42)</a>:</h4>
<p>there's a PR adding one to tokio, but it hasn't merged yet: <a href="https://github.com/tokio-rs/tokio/pull/3591">https://github.com/tokio-rs/tokio/pull/3591</a></p>



<a name="230359934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/async%20aware%20version%20of%20OnceCell/near/230359934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Snoyman <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/async.20aware.20version.20of.20OnceCell.html#230359934">(Mar 15 2021 at 15:06)</a>:</h4>
<p>Got it thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>